package me.zhengjie.modules.easycode.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.EqualsAndHashCode;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.sql.Timestamp;

/**
 * @author guoqing
 * @date 2021-06-16
 */
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("ec_project")
public class Project implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主见id")
    @TableId(type = IdType.AUTO)
    private Integer projectId;

    @ApiModelProperty(value = "用户id")
    @NotNull
    private Long userid;

    @ApiModelProperty(value = "项目类型")
    private Integer projectType;

    @ApiModelProperty(value = "项目本地地址")
    private String projectLocalPath;

    @ApiModelProperty(value = "项目描述")
    private String projectDesc;

    @ApiModelProperty(value = "创建时间")
    @NotNull
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @NotNull
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "项目名称")
    private String projectName;

    @ApiModelProperty(value = "项目编码")
    @NotBlank
    private String projectCode;

    @ApiModelProperty(value = "项目当前类型映射器组id")
    private Integer currentTmGroupId;

    @ApiModelProperty(value = "项目当前莫班组id")
    private Integer currentTemplateGroupId;

    @ApiModelProperty(value = "项目当前全局变量组id")
    private Integer currentGlobalGroupId;

    @ApiModelProperty(value = "当前项目变量组")
    private Integer currentVariableGroupId;

    @ApiModelProperty(value = "项目当前配置文件组id")
    private Integer currentConfigFileGroupId;

    public void copyFrom(Project source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
